/*
 * @Description:
 * @Author: mmzhang
 * @Date: 2021-12-23 15:18:14
 * @LastEditTime: 2022-06-21 15:02:34
 */
import table from '@/components/dt/table/render.js'
import nameOpt from '@/biz/option/name.js'
import dateOpt from '@/biz/option/date.js'
import Opt from '@/components/dt/info/Opt.js'

let _this = null

class Column extends Opt {
  constructor(vm) {
    super()
    _this = vm
    this.build()
  }

  build() {
    this.createAll()
    this.opts.push(...this.all)
  }

  createAll() {
    this.all = [
      {
        field: 'orgName',
        align: 'center',
        header: {
          filter: {
            title: _this.parameter.level > 1 ? '案场' : '分公司',
            key: 'orgName',
            placeholder: '请输入分公司',
            input: {}
          }
        }
      },
      {
        title: _this.textVal + '金额（元）',
        field: 'amount',
        align: 'center',
        remoteSort: true,
        cell:{
          text:{
            type: 'number',
          }
        }
      },
      {
        title: _this.textVal + '套数（套）',
        field: 'quantity',
        align: 'center',
        remoteSort: true,
        cell:{
          text:{
            type: 'number',
            fixed: 0
          }
        }
      },
      {
        title: _this.textVal + '面积（㎡）',
        field: 'area',
        align: 'center',
        remoteSort: true,
        cell:{
          text:{
            type: 'number',
          }
        }
      },
      {
        title: '操作',
        fixed: 'right',
        width: 100,
        align: 'center',
        slots: {
          default: (params, h) => {
            let btns = []
            btns.push({
              title: '查看明细',
              event: 'viewFun',
              data: params.row
            })
            return table.cell.btns(_this, h, btns)
          }
        }
      }
    ]
  }
}

export default Column
